﻿#region Librerias

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;

#endregion


namespace ESF.General.Network.ConfigSettings
{
	[ConfigurationCollection (typeof (ConnectionTestElement))]  
	public class ConnectionTestCollection : ConfigurationElementCollection
	{
		#region Propiedades
		
		public ConnectionTestElement this[int index]
		{
			get 
			{
				return (ConnectionTestElement) BaseGet(index); 
			}
			set
			{
				if (BaseGet(index) != null)
					BaseRemoveAt(index);
					
				BaseAdd(index, value);
			}
		}
		
		
		new public ConnectionTestElement this[string Name]
		{
			get
			{
				return (ConnectionTestElement)BaseGet(Name);
			}
		}
		
		#endregion
		
		
		#region Funciones
		
		

		public int IndexOf(ConnectionTestElement url)
		{
			return BaseIndexOf(url);
		}

		
		public void Add(ConnectionTestElement url)
		{
			BaseAdd(url);
		}
		
		
		protected override void BaseAdd(ConfigurationElement element)
		{
			BaseAdd(element, false);
		}
		

		public void Remove(ConnectionTestElement pCnnTestElem)
		{
			if (BaseIndexOf(pCnnTestElem) >= 0)
				BaseRemove(pCnnTestElem.name);
		}
		
		
		protected override ConfigurationElement CreateNewElement()
		{
			return new ConnectionTestElement();
		}
		
		
		protected override object GetElementKey (ConfigurationElement pElement)
		{
			return ((ConnectionTestElement) pElement).name;
		}
		
		#endregion
	}
}
